package com.project.config;

import com.project.interceptor.LoginInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        注册拦截器
        registry.addInterceptor(new LoginInterceptor())
//        定义拦截范围
                .addPathPatterns("/dept/*");
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/face/**")
                .addResourceLocations("file:/Users/cengyunke/Desktop/整理/j187web-master/interceptor/src/main/resources/static/userface/");
    }
}
